//
//  NYCommentCell.m
//  百思不得姐
//
//  Created by Apple on 15/8/31.
//  Copyright (c) 2015年 Neal. All rights reserved.
//

#import "NYCommentCell.h"
#import "NYTopConment.h"
#import "NYTopUser.h"
@interface NYCommentCell ()
@property (weak, nonatomic) IBOutlet UIImageView *profileImageView;
@property (weak, nonatomic) IBOutlet UIImageView *sexView;
@property (weak, nonatomic) IBOutlet UILabel *usernameLabel;
@property (weak, nonatomic) IBOutlet UILabel *likeCountLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UIButton *voiceButton;

@end
@implementation NYCommentCell

- (void)awakeFromNib {
    UIImageView *bgview = [[UIImageView alloc]init];
    bgview.image = [UIImage imageNamed:@"mainCellBackground"];
    self.backgroundView = bgview;
    self.contentLabel.numberOfLines = 0;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setComment:(NYTopConment *)comment
{
    _comment = comment;
    [self.profileImageView setHeaderImageWithUrl:comment.user.profile_image];
    self.sexView.image = [comment.user.sex isEqualToString:NYUserSexMale]?[UIImage imageNamed:@"Profile_manIcon"]:[UIImage imageNamed:@"Profile_womanIcon"];
    
    self.contentLabel.text = comment.content;
    [self.contentLabel sizeToFit];
    self.usernameLabel.text = comment.user.username;
    self.likeCountLabel.text = comment.like_count;
    
    if (comment.voiceuri.length) {
        self.voiceButton.hidden = NO;
        [self.voiceButton setTitle:comment.voicetime forState:UIControlStateNormal];
        self.contentLabel.hidden = YES;
    } else {
        self.voiceButton.hidden = YES;
        self.contentLabel.hidden = NO;

    }
    
}

@end
